package com.neolix.udpserver;

import java.net.InetAddress;

public class ClientInfo {
    private InetAddress address;
    private int port;
    private long time;

    public void setTime(long time) {
        this.time = time;
    }

    public long getTime() {
        return time;
    }

    public ClientInfo(InetAddress address, int port) {
        this.address = address;
        this.port = port;
    }

    public InetAddress getAddress() {
        return address;
    }

    public void setAddress(InetAddress address) {
        this.address = address;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ClientInfo that = (ClientInfo) o;
        return port == that.port
                && that.address != null
                && that.address.getHostName() != null
                && address != null
                && address.getHostName() != null
                && address.getHostName().equals(that.address.getHostName());
    }

}